/* ============================================================
   blog-enhance.css — 博客增强功能样式表
   包含：暗色模式 / 阅读进度条 / 返回顶部 / 目录 / 分享按钮
        相关文章 / 前后导航 / 搜索 / 分页 / 阅读时间 / 标签
        打印样式 / 邮件订阅
   ============================================================ */

/* ===== 暗色模式 (Dark Mode) ===== */
[data-theme="dark"] {
  --page-bg: #1a1d1c;
  --surface: #252927;
  --surface-soft: #2f3431;
  --ink: #d4cec1;
  --ink-soft: #b5ac9c;
  --muted: #8c7d64;
  --accent: #c9a64e;
  --accent-dark: #d4b868;
  --accent-cool: #c45a6e;
  --line: rgba(180, 160, 120, 0.18);
  --shadow-sm: 0 12px 28px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 24px 58px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] body {
  background-image:
    linear-gradient(180deg, rgba(26,29,28,0.98) 0%, rgba(26,29,28,1) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(180,160,120,0.008) 2px, rgba(180,160,120,0.008) 4px);
}

[data-theme="dark"] .navbar-default {
  background: rgba(30, 33, 31, 0.95) !important;
  border-bottom-color: rgba(180, 160, 120, 0.12);
}

[data-theme="dark"] .background-gray-lightest {
  background: linear-gradient(135deg, rgba(185,147,66,0.08) 0%, rgba(111,29,45,0.04) 100%);
  background-color: #1f2321;
}

[data-theme="dark"] .post,
[data-theme="dark"] .post-content,
[data-theme="dark"] .category-card,
[data-theme="dark"] .friend-card {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .post-content p {
  color: #c5bfb0;
}

[data-theme="dark"] .breadcrumb {
  background: rgba(37, 41, 39, 0.8);
}

[data-theme="dark"] .breadcrumb > li + li:before {
  color: var(--muted);
}

[data-theme="dark"] .footer__copyright {
  background: #0f1211;
}

[data-theme="dark"] .footer__block {
  background: #151917;
}

[data-theme="dark"] .dropdown-menu {
  background: var(--surface);
  border-color: var(--line);
}

[data-theme="dark"] .dropdown-menu > li > a {
  color: var(--ink-soft);
}

[data-theme="dark"] .dropdown-menu > li > a:hover {
  background: var(--surface-soft);
  color: var(--accent);
}

[data-theme="dark"] .btn-ghost {
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="dark"] .btn-ghost:hover {
  background: var(--accent);
  color: #1a1d1c;
}

[data-theme="dark"] .post-content blockquote {
  background: rgba(185, 147, 66, 0.08);
  border-left-color: var(--accent);
}

[data-theme="dark"] .category-list a {
  color: var(--ink-soft);
}

[data-theme="dark"] .category-list a:hover {
  color: var(--accent);
  background: rgba(185, 147, 66, 0.08);
}

[data-theme="dark"] .navbar-default .navbar-nav > li > a {
  color: var(--ink-soft);
}

[data-theme="dark"] .navbar-default .navbar-nav > li > a:hover,
[data-theme="dark"] .navbar-default .navbar-nav > .active > a {
  color: var(--accent);
}

[data-theme="dark"] .navbar-brand {
  color: var(--accent) !important;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] .section--padding-bottom-small {
  background: var(--page-bg);
}


/* ===== 导航栏按钮容器 ===== */
.navbar .container {
  position: relative;
}

/* ===== 主题切换按钮 (Theme Toggle) ===== */
.theme-toggle {
  position: absolute;
  right: -80px;
  top: 16px;
  background: none;
  border: 1px solid rgba(116, 83, 30, 0.2);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 10;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(185, 147, 66, 0.08);
}

[data-theme="dark"] .theme-toggle {
  border-color: rgba(180, 160, 120, 0.25);
  color: #c9a64e;
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(201, 166, 78, 0.12);
}

/* 移动端适配 */
@media (max-width: 767px) {
  .theme-toggle {
    right: 56px;
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .search-toggle {
    right: 92px;
    width: 30px;
    height: 30px;
    font-size: 12px;
  }
}
.search-toggle {
  position: absolute;
  right: -40px;
  top: 16px;
  background: none;
  border: 1px solid rgba(116, 83, 30, 0.2);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  z-index: 10;
}

.search-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(185, 147, 66, 0.08);
}

/* ===== 阅读进度条 (Reading Progress Bar) ===== */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 2px 0 0;
}


/* ===== 返回顶部按钮 (Back to Top) ===== */
#back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s ease;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

@media (max-width: 767px) {
  #back-to-top {
    bottom: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    font-size: 14px;
  }
}


/* ===== 目录 (Table of Contents) ===== */
.toc-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.toc-container summary {
  font-family: 'Roboto Condensed', 'Noto Serif SC', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: 0.04em;
  user-select: none;
  padding: 4px 0;
}

.toc-container summary:hover {
  color: var(--accent);
}

.toc-nav {
  margin-top: 12px;
  padding-left: 0;
  list-style: none;
}

.toc-nav a {
  display: block;
  padding: 5px 0;
  padding-left: 12px;
  color: var(--ink-soft);
  font-size: 15px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.toc-nav a:hover,
.toc-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(185, 147, 66, 0.04);
}

.toc-nav a.toc-h3 {
  padding-left: 28px;
  font-size: 14px;
}

@media (max-width: 767px) {
  .toc-container {
    padding: 14px 18px;
    margin-bottom: 18px;
  }

  .toc-nav a {
    font-size: 14px;
    padding: 4px 0;
    padding-left: 8px;
  }
}


/* ===== 阅读时间 (Reading Time) ===== */
.reading-time {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  background: rgba(185, 147, 66, 0.06);
  border: 1px solid rgba(116, 83, 30, 0.12);
  border-radius: 999px;
  padding: 3px 14px;
  margin-left: 10px;
  vertical-align: middle;
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.03em;
}


/* ===== 分享按钮 (Share Buttons) ===== */
.share-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 0;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 980px;
  margin: 0 auto;
}

.share-buttons span {
  font-size: 14px;
  color: var(--muted);
  margin-right: 4px;
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.06em;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 15px;
  transition: all 0.25s ease;
  text-decoration: none;
}

.share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(185, 147, 66, 0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.share-btn.copy-success {
  border-color: #4caf50;
  color: #4caf50;
  background: rgba(76, 175, 80, 0.08);
}


/* ===== 上一篇/下一篇导航 (Article Nav) ===== */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 0 20px;
}

.article-nav a {
  flex: 1;
  max-width: 48%;
  display: block;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 15px;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
  line-height: 1.5;
}

.article-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.article-nav-prev {
  text-align: left;
}

.article-nav-next {
  text-align: right;
  margin-left: auto;
}

.article-nav-placeholder {
  flex: 1;
  max-width: 48%;
  visibility: hidden;
}

@media (max-width: 767px) {
  .article-nav {
    flex-direction: column;
    gap: 10px;
    padding: 0 16px 16px;
  }

  .article-nav a {
    max-width: 100%;
    padding: 12px 16px;
    font-size: 14px;
  }
}


/* ===== 相关文章 (Related Posts) ===== */
.related-posts-section {
  padding-top: 48px;
  padding-bottom: 48px;
}

.related-posts .post {
  height: 100%;
}

.related-posts .post__intro {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ===== 搜索覆盖层 (Search Overlay) ===== */
#search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 13, 0.92);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

#search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-overlay-inner {
  width: 100%;
  max-width: 640px;
  padding: 0 24px;
}

#search-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 20px;
  font-family: 'Roboto', 'Noto Sans SC', sans-serif;
  background: rgba(255, 250, 240, 0.08);
  border: 2px solid rgba(185, 147, 66, 0.3);
  border-radius: var(--radius);
  color: #d4cec1;
  outline: none;
  transition: border-color 0.2s ease;
}

#search-input:focus {
  border-color: var(--accent);
}

#search-input::placeholder {
  color: rgba(212, 206, 193, 0.35);
}

#search-results {
  margin-top: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 14px 18px;
  margin-bottom: 6px;
  background: rgba(255, 250, 240, 0.04);
  border: 1px solid rgba(255, 250, 240, 0.06);
  border-radius: 6px;
  color: #b5ac9c;
  text-decoration: none;
  transition: all 0.2s ease;
}

.search-result-item:hover {
  background: rgba(185, 147, 66, 0.1);
  border-color: rgba(185, 147, 66, 0.25);
  color: #d4cec1;
}

.search-result-title {
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 17px;
  color: #d4cec1;
  margin-bottom: 4px;
}

.search-result-meta {
  font-size: 13px;
  color: #88765b;
}

.search-result-excerpt {
  font-size: 14px;
  margin-top: 6px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#search-close {
  position: fixed;
  top: 24px;
  right: 32px;
  background: none;
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: rgba(255, 250, 240, 0.6);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10001;
}

#search-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.search-empty {
  text-align: center;
  color: #88765b;
  padding: 40px 0;
  font-size: 15px;
}

/* body 锁定滚动 */
body.search-open {
  overflow: hidden;
}


/* ===== 分页 (Pagination) ===== */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 32px 0 16px;
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Roboto Condensed', sans-serif;
  user-select: none;
}

.pagination-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}


/* ===== 标签药丸 (Tag Pills) ===== */
.tag-pill {
  display: inline-block;
  padding: 3px 12px;
  font-size: 12px;
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid rgba(116, 83, 30, 0.15);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  text-decoration: none;
  margin: 2px 3px;
}

.tag-pill:hover,
.tag-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(185, 147, 66, 0.06);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 8px 0 24px;
}

.tag-cloud-label {
  font-size: 13px;
  color: var(--muted);
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.06em;
  margin-right: 6px;
  align-self: center;
}


/* ===== 邮件订阅 (Newsletter) ===== */
.newsletter-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  max-width: 400px;
}

.newsletter-form input[type="email"] {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  font-family: 'Roboto', 'Noto Sans SC', sans-serif;
  transition: border-color 0.2s ease;
}

.newsletter-form input[type="email"]:focus {
  border-color: var(--accent);
}

.newsletter-form button {
  padding: 10px 20px;
  font-size: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.newsletter-form button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

[data-theme="dark"] .newsletter-form input[type="email"] {
  background: rgba(255, 250, 240, 0.06);
  border-color: rgba(180, 160, 120, 0.2);
  color: #d4cec1;
}


/* ===== 文章日期标签 (Article Date on Cards) ===== */
.post-date {
  font-size: 13px;
  color: var(--muted);
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.04em;
  padding: 0 24px;
  margin-top: -8px;
  margin-bottom: 6px;
}


/* ===== 分类标签徽章 (Category Badge) ===== */
.category-badge {
  display: inline-block;
  font-size: 12px;
  font-family: 'Roboto Condensed', sans-serif;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 10px;
  margin-left: 24px;
  margin-bottom: 8px;
  text-transform: uppercase;
}


/* ===== 搜索框（内联） ===== */
.inline-search {
  text-align: center;
  padding: 20px 0 8px;
}

.inline-search input {
  width: 100%;
  max-width: 480px;
  padding: 12px 18px;
  font-size: 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  font-family: 'Roboto', 'Noto Sans SC', sans-serif;
  transition: border-color 0.2s ease;
}

.inline-search input:focus {
  border-color: var(--accent);
}

.inline-search input::placeholder {
  color: var(--muted);
}


/* ===== 文章卡片等高 (Cards Equal Height) ===== */
/* 修复 .articles-container 包裹后选择器失效的问题 */
.articles-container .row,
section .container > .row {
  display: flex;
  flex-wrap: wrap;
}

.articles-container .row > [class*="col-"],
section .container > .row > [class*="col-"] {
  display: flex;
  flex-direction: column;
}

.articles-container .post,
section .container > .row .post {
  height: calc(100% - 36px);
}
@media print {
  /* 隐藏导航元素 */
  .header,
  .navbar,
  #progress-bar,
  #back-to-top,
  .theme-toggle,
  .search-toggle,
  .share-buttons,
  #search-overlay,
  .article-nav,
  .related-posts-section,
  .footer,
  .giscus,
  .toc-container,
  #login-modal {
    display: none !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 13pt !important;
    line-height: 1.6 !important;
  }

  .post-content {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .post-content p {
    color: #000 !important;
  }

  .blog-post {
    background: #fff !important;
  }

  .carousel,
  .carousel-inner,
  .carousel-fullscreen {
    display: none !important;
  }

  a {
    color: #000 !important;
    text-decoration: underline !important;
  }

  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
}


/* ===== 过渡动画辅助 ===== */
.fade-in {
  animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ===== 404 页面 ===== */
.error-page {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-page-inner h1 {
  font-size: clamp(72px, 12vw, 140px);
  color: var(--accent);
  margin-bottom: 8px;
  font-family: 'Roboto Condensed', sans-serif;
}

.error-page-inner p {
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.error-page-inner .btn-ghost {
  display: inline-block;
  padding: 12px 28px;
  font-size: 15px;
  margin: 0 6px;
}


/* ===== 搜索内联结果 ===== */
.inline-search-results {
  max-width: 480px;
  margin: 0 auto;
  text-align: left;
}

.inline-search-results .search-result-item {
  background: var(--surface);
}
